#ifndef BMP_STRUCT_H_INCLUDED
#define BMP_STRUCT_H_INCLUDED
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "HuffTree.h"
#include "FileContent.h"

typedef struct /**** BMP file header structure ****/
 {
     char Type[2]; /* Magic number for file */
     unsigned int Size; /* Size of file */
     unsigned short int Reserved1; /* Reserved */
     unsigned short int Reserved2; /* ... */
     unsigned int OffBits; /* Offset to bitmap data */
 } BMPFILEHEADER;

 typedef struct /**** BMP file info structure ****/
 {
     unsigned int biSize; /* Size of info header */
     int biWidth; /* Width of image */
     int biHeight; /* Height of image */
     unsigned short biPlanes; /* Number of color planes */
     unsigned short biBitCount; /* Number of bits per pixel */
     unsigned int biCompression; /* Type of compression to use */
     unsigned int biSizeImage; /* Size of image data */
     int biXPelsPerMeter; /* X pixels per meter */
     int biYPelsPerMeter; /* Y pixels per meter */
     unsigned int biClrUsed; /* Number of colors used */
     unsigned int biClrImportant; /* Number of important colors */
 } BMPINFOHEADER;

 typedef struct /**** BMP rgb info structure ****/
 {
    char Blue;
    char Green;
    char Red;
    //unsigned char Reserved;
 }CONTENTIMAGE;


void readFileHeader(FILE *F, BMPFILEHEADER *H);
void readInfoHeader(FILE *F,BMPINFOHEADER *IH);
void readContenImage(FILE *F, CONTENTIMAGE *C);
void readContenImage_c(FILE *F, CONTENTIMAGE *C);
void calcDiff(CONTENTIMAGE *C,char *container,int length);
void writeFile(FILE *F,BMPFILEHEADER *H,BMPINFOHEADER *IH,FileContent *fileContent, int leafNumber, HuffTree* huffTree);
void writeFile_d(FILE *F,BMPFILEHEADER *H,BMPINFOHEADER *IH,FileContent *fileContent,int length);
void preencheArq(FILE *F, unsigned char* buffer, int totalBits);
void writeFile_emanuel(FILE *F,BMPFILEHEADER *H,BMPINFOHEADER *IH,FileContent *fileContent, int leafNumber, HuffTree* huffTree);


#endif // BMP_STRUCT_H_INCLUDED
